​
#include <iostream>
#include <vector>
using namespace std;
 
int main()
{
	int T = 0;
	cin >> T;
	while (T--)
	{
		int n = 0, k = 0;
		cin >> n >> k;
		vector<int> arr(2 * n, 0);
		for (int i = 0; i < 2 * n; ++i)
		{
			cin >> arr[i];
		}
		while (k--)
		{
			vector<int> tmp1(arr.begin(), arr.begin() + n);
			vector<int> tmp2(arr.begin() + n, arr.end());
			for (int i = 0, j = 0; i < n; ++i)
			{
				arr[j++] = tmp1[i];
				arr[j++] = tmp2[i];
			}
		}
		for (auto& e : arr)
		{
			cout << e << " ";
		}
		cout << endl;
	}
	return 0;
}